package com.java.threadsafe.synchronize;

/* 线程同步，执行完一个再执行另一个 */
public class Safe {
	public static void main(String args[]){
		Runnable entity = new ThreadSynchronizeEntity();
		Thread thread1 = new Thread(entity, "thread1");
		Thread thread2 = new Thread(entity, "thread2");
		thread1.start();
		thread2.start();
	}
}

/*运行结果:
	thread1 ---- 2
	thread1 ---- 3
	thread1 ---- 4
	thread1 ---- 5
	thread1 ---- 6
	thread2 ---- 2
	thread2 ---- 3
	thread2 ---- 4
	thread2 ---- 5
	thread2 ---- 6

*/